import {cbs} from "../../../config/settings";


module.exports = {
	name: 'card',
	data() {

		return {
      value: '',
      Transports : [
        {title: '2018-8-21 10:31', description:'从怡宝广州生产基地出发，目的地：天河五山水店'},
        {title: '2018-8-22 14:12', description:'送达天河区五山茶山区路翠华花园106铺'},
        {title: '2018-8-24 08:26', description:'送达天河区五山华南农业大学分店'},
        {title: '2018-8-25 09:30', description:'交付给送水员003号 李XX'},
        {title: '2018-8-25 11:30', description:'送达数学与信息科学学院院楼'},
        {title: '2018-8-25 11:50', description:'交付给买家'},
        {title: '2018-8-25 14:24', description:'买家确认收货，交易结束'}
      ],
      Products : [
        {title: '2018-8-20 09:13', description:'出库'},
        {title: '2018-8-20 09:41', description:'入库'},
        {title: '2018-8-20 10:36', description:'套膜'},
        {title: '2018-8-20 10:57', description:'灯检'},
        {title: '2018-8-20 11:32', description:'封盖'},
        {title: '2018-8-20 14:32', description:'灌装'},
        {title: '2018-8-20 15:25', description:'过滤'},
        {title: '2018-8-20 15:53', description:'消毒'},
        {title: '2018-8-20 16:14', description:'三级精滤'},
        {title: '2018-8-20 16:53', description:'取水'},
      ],

      //定义配送关键字
      transportList:[],

      //定义溯源关键字
      productList:[],

      //定义产品基本信息
      waterSourceMassageList:[],


      //table
      table1:{
        title:'配送过程'
      },
      table2:{
        title:'生产过程'
      },
      table3:{
        title:"水源信息"
      },
      // dialog1配送过程对话框
      dialog1: {
        title: '产品溯源数据',
        show: false,
        modal: false
      },
      // dialog2生产过程对话框
      dialog2:{
        title:'产品溯源数据',
        show:false,
        modal:false
      },
      // dialog水源信息对话框
      dialog3:{
        title:'产品溯源数据',
        show:false,
        modal:false
      },
      tableData_inspections:[{
        Date: '2018-08-22 09：28',
        Production: '怡宝桶装水',
        Company: '华润怡宝饮料（中国）有限公司'
      }],
    }
	},
	props: {
    item: {
      type: Object,
      default: {}
    },
    isShowCheck: {
      type: Boolean,
      default: false
    },
    checkLabel: {
      type: String,
      default: undefined
    },
    btnLabel: {
      type: String,
      default: '编辑'
    },
    btnLabel2: {
      type: String,
      default: '查询'
    },
		label: {
			default: null
		},
		maskText: {
			type: String,
			default: ''
		},
		maskVisible: {
			type: Boolean,
			default: false
		}

	},
	methods: {
		onClick(e) {
			this.$emit('btnclick', this.value)
		},
    //打开配送对话框
    onClick1() {
      this.dialog1.show = true;
      this.dialog2.show = false;
      this.dialog3.show = false;
    },
    //打开生产信息对话框
    onClick2(){
      this.dialog1.show = false;
      this.dialog2.show = true;
      this.dialog3.show = false;
    },
    //打开水源信息对话框
    onClick3(){
      this.dialog1.show = false;
      this.dialog2.show = false;
      this.dialog3.show = true;
    },
    getTransportMassageList(){
      let data = this.$$fromData({
        pageNum: 1,
        pageSize: 1000
      })
      this.$$api_product_TransportMassage(data, res => {
        if(res.event === 0) {
          this.transportList = res.obj;
        }else {
          cbs.submitError.call(this, `获取配送信息失败，${res.msg}`);
        }
      })
	  },
    getProductMassageList(){
      let data = this.$$fromData({
        pageNum: 1,
        pageSize: 1000
      })
      this.$$api_product_ProductMassage(data, res => {
        if(res.event === 0) {
          this.productList = res.obj;
        }else {
          cbs.submitError.call(this, `获取生产信息失败，${res.msg}`);
        }
      })
    },
    getWaterSourceMassageList(){
      let data = this.$$fromData({
        pageNum: 1,
        pageSize: 1000
      })
      this.$$api_product_WaterSourceMassager(data, res => {
        if(res.event === 0) {
          this.waterSourceMassageList = res.obj;
        }else {
          cbs.submitError.call(this, `获取水源信息失败，${res.msg}`);
        }
      })
    }
  },
  created() {
    this.getTransportMassageList();
    this.getProductMassageList();
    this.getWaterSourceMassageList();
  },

}
